package com.wangtianxiang.sxp.dbbase.config.session;

import org.apache.ibatis.session.*;

import java.sql.Connection;

/**
 * SqlSessionFactory 代理对象
 */
public class SxpSqlSessionFactoryProxy implements SqlSessionFactory{

	private SqlSessionFactory sqlSessionFactory;
	
	public SxpSqlSessionFactoryProxy(SqlSessionFactory sqlSessionFactory) {
		this.sqlSessionFactory =sqlSessionFactory;
	}

	/**
	 * 获取代理的对象
	 * @return
	 */
	public SqlSessionFactory getProxySqlSessionFactory() {
		return sqlSessionFactory;
	}

	@Override
	public SqlSession openSession() {
		return sqlSessionFactory.openSession();
	}

	@Override
	public SqlSession openSession(boolean autoCommit) {
		return sqlSessionFactory.openSession(autoCommit);
	}

	@Override
	public SqlSession openSession(Connection connection) {
		return sqlSessionFactory.openSession(connection);
	}

	@Override
	public SqlSession openSession(TransactionIsolationLevel level) {
		return sqlSessionFactory.openSession(level);
	}

	@Override
	public SqlSession openSession(ExecutorType execType) {
		return sqlSessionFactory.openSession(execType);
	}

	@Override
	public SqlSession openSession(ExecutorType execType, boolean autoCommit) {
		return sqlSessionFactory.openSession(execType, autoCommit);
	}

	@Override
	public SqlSession openSession(ExecutorType execType, TransactionIsolationLevel level) {
		return sqlSessionFactory.openSession(execType, level);
	}

	@Override
	public SqlSession openSession(ExecutorType execType, Connection connection) {
		return sqlSessionFactory.openSession(execType, connection);
	}

	@Override
	public Configuration getConfiguration() {
		return sqlSessionFactory.getConfiguration();
	}

}
